package com.surprise.db.dao.join;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.surprise.db.dao.SimpleDAO;
import com.surprise.db.entity.join.SelectSurpriseProduct001Entity;

/**
 * SelectSurpriseProduct001.java
 * @author xuling
 * @since 2017年9月28日
 */
@Repository
public class SelectSurpriseProduct001 extends SimpleDAO<SelectSurpriseProduct001Entity> {

	/**
	 * 获得商户的商品信息
	 * @param shopid 商户ID
	 * @return 商户的商品信息
	 */
	public List<SelectSurpriseProduct001Entity> select(Long shopid) {
		String sql = " SELECT surprise_product.id as productid, surprise_product.productName, surprise_shop.startTime, surprise_shop.endTime " +
				" FROM surprise_product INNER JOIN surprise_shop ON surprise_product.surpriseShopId = surprise_shop.id " +
				" WHERE surprise_shop.id = ? ORDER BY surprise_product.id";
		return super.findBySql(sql, shopid);
	}
}
